package com.wxs.mapper;

import com.wxs.pojo.User;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper {

    public List<User> getUsers() {
        UserMapper userMapper = getSqlSession().getMapper(UserMapper.class);
        User user1 = new User(9, "小王", "1231231231231");
        userMapper.addUser(user1);

        userMapper.deleteUser(8);

        return userMapper.getUsers();
    }

    public int addUser(User user) {
        return getSqlSession().getMapper(UserMapper.class).addUser(user);
    }

    public int deleteUser(int id) {
        return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }
}
